from flask.json import jsonify
from flask import Response
from json import dumps


class JSONResponse(Response):
    def __init__(self, data, msg=''):
        result = dumps(dict(data=data, code="200", msg=msg))
        Response.__init__(self, result, mimetype='application/json')
